'use strict';
/**
 * @bussiness {聊天}
 * @author {填写作者}
 * @date {创建时间}
 * **/
const Controller = require('egg').Controller;
class Chat extends Controller {
    /**@effect IO***/
    async takeChatAsIO(){
        const {ctx, app} = this;
        const query = ctx.request.query;
        const id = query.id;
        const nsp = app.io.of('/');
        console.log(nsp)
        if(nsp){ // 通过id给指定连接发送信息
            nsp.emit('res', 'hello word');

        }
        nsp.server.sockets.emit('room', 'byebye')
        ctx.body = {
            status:200,
            data:{},
            msg:"success"
        }
    };
}
module.exports = Chat